@echo off
echo 正在编译考试之路游戏...
echo.

REM 设置Godot路径
set GODOT_PATH=D:\download\Godot_v4.2-stable_win64.exe\Godot_v4.2-stable_win64.exe

REM 检查Godot是否存在
if not exist "%GODOT_PATH%" (
    echo 错误: 找不到Godot执行文件
    echo 路径: %GODOT_PATH%
    pause
    exit /b 1
)

REM 创建builds目录
if not exist "builds" mkdir builds

echo 1. 检查项目语法...
"%GODOT_PATH%" --headless --check-only
if %errorlevel% neq 0 (
    echo 错误: 项目语法检查失败
    pause
    exit /b 1
)

echo.
echo 2. 导出Android版本...
"%GODOT_PATH%" --headless --export-debug "Android" "builds/考试之路.apk"
if %errorlevel% neq 0 (
    echo 错误: Android导出失败
    pause
    exit /b 1
)

echo.
echo 3. 导出Windows版本...
"%GODOT_PATH%" --headless --export-debug "Windows Desktop" "builds/考试之路.exe"
if %errorlevel% neq 0 (
    echo 错误: Windows导出失败
    pause
    exit /b 1
)

echo.
echo 编译完成！
echo Android版本: builds/考试之路.apk
echo Windows版本: builds/考试之路.exe
echo.
pause
